<?php

namespace app\proxy\controller\data;

use app\common\model\settings\Region as RegionModel;
use app\proxy\controller\Controller;

/**
 * 地址控制器
 */
class Region extends Controller
{
    /**
     * 地区列表
     */
    public function lists()
    {
        $regionData = RegionModel::getCacheTree();
        return $this->renderSuccess('', compact('regionData'));
    }

    /**
     * 获取省市区
     */
    public function getnewlist(){
        $params = $this->request->param();
        $treelv = isset($params['treelv'])?(int)$params['treelv']:0;
        $regionData = RegionModel::getRegionForApi($treelv);
        return $this->renderSuccess('', compact('regionData'));
    }

}
